package com.example.student.controller;
import com.example.student.pojo.Result;

import com.example.student.service.ScoreExcelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 成绩excel生成
 * @author 34082
 */
@RestController
@Slf4j
public class ScoreExcelController {

    private ScoreExcelService excelService;

    @Autowired
    public void setExcelService(ScoreExcelService excelService) {
        this.excelService = excelService;
    }

    @GetMapping("/generate")
    public Result generateAllReport() {
        excelService.createAllReport();
        return Result.success();
    }

    @GetMapping("/generateByClass/{classId}")
    public Result generateReportByClass(@PathVariable Integer classId) {
        excelService.createReportByClass(classId);
        return Result.success();
    }
}